# fileName=(r"D:\work\pythonProject\bao\dada.txt")
#
# f=open(fileName,encoding='utf-8')
# print(f.read())
class dofile():
    def baibai(self):
        fileName=(r"D:\work\pythonProject\bao\dada.txt")
        f=open(fileName,mode='a',encoding='utf-8')
        f.write("asdfg")
        f.close()

    def baibao(self):
        fileName = (r"D:\work\pythonProject\bao\jjj.png")

        with open(fileName,mode='r+b')as f:
            print(f,type(f))
            a=f.read()
            return a
    def pngwrite(self,fname,strs):
        fileName = (rf"D:\work\pythonProject\bao\{fname}")

        with open(fileName,mode='w+b')as f:
            f.write(strs)



if __name__ == '__main__':
    # f1=dofile
    # dofile.baibai('wfebdd')
    df=dofile()
    faw=df.baibao()#读取文件内容
    fileName = "jjj.png"
    df.pngwrite(fileName,faw)#写一个文件
